package cn.opopopo.design_pattern_learn.行为型.strategy;

public class StrategyPatternDemo {
    public static void main(String[] args) {
        ShoppingCart cart = new ShoppingCart();

        // 普通用户结账
        cart.setDiscountStrategy(new NoDiscountStrategy());
        cart.checkout(100.0);

        System.out.println("-----");

        // 会员用户
        cart.setDiscountStrategy(new MemberDiscountStrategy());
        cart.checkout(100.0);

        System.out.println("-----");

        // VIP 用户
        cart.setDiscountStrategy(new VipDiscountStrategy());
        cart.checkout(100.0);
    }
}